<template>
  <el-dialog
    :model-value="dialogFormVisible"
    :title="title"
    :width="width"
    @close="close"
  >
    <slot name="center"></slot>
    <template #footer>
      <div class="dialog-footer">
        <el-button @click="handleClose">取消</el-button>
        <el-button type="primary" @click="handleConfirm"> 确定 </el-button>
      </div>
    </template>
  </el-dialog>
</template>

<script lang="ts" setup>
defineProps({
  dialogFormVisible: {
    type: Boolean,
    default: false,
  },
  title: {
    type: String,
    defalut: '自定义标题',
  },
  width: {
    type: String,
    defalut: '500px',
  },
});

const emit = defineEmits(['update:dialogFormVisible', 'handleClick']);

const handleClose = () => {
  emit('update:dialogFormVisible', false);
};

const handleConfirm = () => {
  // 可以加入确认逻辑
  emit('handleClick');
};
const close = () => {
  emit('update:dialogFormVisible', false);
};
</script>
